package com.wjk.kylin.mall.member.controller;

import com.wjk.kylin.mall.common.core.dto.base.BaseOutDTO;
import com.wjk.kylin.mall.common.core.dto.base.DataIdInDTO;
import com.wjk.kylin.mall.common.core.dto.member.MemberUserNameInDTO;
import com.wjk.kylin.mall.member.dto.MemberInDTO;
import com.wjk.kylin.mall.member.service.IMemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: wangjinkui
 * @Date: 2021/5/28
 * @Description : 会员信息
 */
@RestController
@RequestMapping("/member")
public class MemberController {

    @Autowired
    private IMemberService memberService;
    /**
     * 查询
     */
    @PostMapping("/get")
    public BaseOutDTO get(@Validated @RequestBody DataIdInDTO inDTO){
        return memberService.getById(inDTO);
    }
    /**
     * 新增
     */
    @PostMapping("/add")
    public BaseOutDTO add(@Validated @RequestBody MemberInDTO inDTO){
        return memberService.add(inDTO);
    }

    @PostMapping("/loadUserByUsername")
    public BaseOutDTO loadUserByUsername(@Validated @RequestBody MemberUserNameInDTO inDTO){
        return memberService.loadUserByUsername(inDTO);
    }

}
